<template>
	<view>
		<u-overlay :show="showOverlay" opacity="0.7" :mask-click-able="maskClick" @touchmove.stop.prevent="moveStop">
			<view class="sys-del">
				<view class="sys-del-content">
					<view v-show="title" class="sys-del-text">
						{{title}}
					</view>
					<slot />
					<view class="btnBox" v-if="showBtnBox">
						<view class="btnItem" :class="changeClass?'customizeBlackButton':'customizeWhiteButton'"
							@click.stop="confirm">确认</view>
						<view class="btnItem" :class="!changeClass?'customizeBlackButton':'customizeWhiteButton'"
							@click.stop="cancel">取消</view>
					</view>
				</view>
			</view>
		</u-overlay>
	</view>
</template>

<script>
	/* 
	 * maskClick {Boolean} 遮罩是否可点击
	 * show {Boolean}遮罩是否可点击这招打开状态
	 * confirm 点击确定市回调
	 * cancel 点击取消时回调
	 * showBtnBox 是否显示按钮组
	 */
	export default {
		name: "sys-delModal",
		data() {
			return {
				showOverlay: false
			};
		},
		props: {
			show: {
				default: false,
				type: Boolean,
			},
			title: {
				default: "",
				type: String,
			},
			maskClick: {
				default: false,
				type: Boolean,
			},
			showBtnBox: {
				default: true,
				type: Boolean,
			},
			changeClass: {
				default: true,
				type: Boolean,
			}
		},
		watch: {
			show: {
				handler: function(value, oldVal) {
					this.showOverlay = value
				},
				deep: true,
				immediate: true
			},
			showBtnBox: {
				handler: function(value, oldVal) {
					console.log('showBtnBox', this.showBtnBox);
				},
				deep: true,
				immediate: true
			},
			changeClass: {
				handler: function(value, oldVal) {
					console.log('showBtnBox', this.showBtnBox);
				},
				deep: true,
				immediate: true
			},
		},
		methods: {
			confirm() {
				this.$emit('confirm')
			},
			cancel() {
				this.$emit('cancel')
			},
			// 禁止滚动
			moveStop() {

			},
		}
	}
</script>

<style lang="scss" scoped>
	.sys-del {
		box-sizing: border-box;
		margin: 0 auto;
		width: 540rpx;
		padding: 6rpx;
		background: #FFFFFF;
		border-radius: 12rpx;
		position: relative;
		top: 30%;

		.sys-del-content {
			width: 100%;
			background: linear-gradient(188.46deg, #F4FFD5 8.38%, rgba(255, 255, 255, 0) 95.44%);

			.sys-del-text {
				text-align: center;
				font-size: 32rpx;
				padding-top: 42rpx;
				color: #1F1F1F;
			}

			.btnBox {
				margin-top: 42rpx;
				display: flex;
				align-items: center;
				justify-content: space-around;
				padding-bottom: 26rpx;

				.btnItem {
					width: 212rpx;
					border-radius: 70rpx !important;
					text-align: center;
				}
			}
		}
	}
</style>